﻿using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MVVMBaseObject
{
    public class MainViewModel : BindableBase
    {
        //基础的通知属性
        private string _value;

        public string Value
        {
            get { return _value; }
            set
            {
                //第一种方式
                SetProperty<string>(ref _value, value);

                //第二种方式
                //RaisePropertyChanged(nameof(Value));

                //第三种方式
                //this.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs(nameof(Value)));
            }
        }

        /// <summary>
        /// 命令属性定义
        /// </summary>
        public DelegateCommand<object> ButtonCommand { get; set; }

        public MainViewModel()
        {
            ButtonCommand = new DelegateCommand<object>(arg =>
            {
                Console.WriteLine("1111111111111");
            });
        }
    }
}
